// 工程质量
import { req } from '@/utils/request'

// 阶段
export const listCheckType = data => req.get('/cq/cqCheckType/list', data)
export const addCheckType = data => req.post('/cq/cqCheckType/add', data)
export const updateCheckType = data => req.post('/cq/cqCheckType/edit', data)
export const delCheckType = typeId => req.post(`/cq/cqCheckType/delete?typeId=${typeId}`)

// 工序
export const listCheckTable = data => req.get('/cq/cqCheckTable/list', data)
export const addCheckTable = data => req.post('/cq/cqCheckTable/add', data)
export const updateCheckTable = data => req.post('/cq/cqCheckTable/edit', data)
export const delCheckTable = tableId => req.post(`/cq/cqCheckTable/delete?tableId=${tableId}`)

// 其他抽检流程
export const listRdcCourse = data => req.get('/cq/cqRdcCourse/list', data)
export const addRdcCourse = data => req.post('/cq/cqRdcCourse/add', data)
export const updateRdcCourse = data => req.post('/cq/cqRdcCourse/edit', data)
export const delRdcCourse = courseId => req.post(`/cq/cqRdcCourse/delete?courseId=${courseId}`)

// 验收标准
export const listCheckStandard = data => req.get('/cq/cqCheckTable/standardlist', data)
export const addCheckStandard = data => req.post('/cq/cqCheckStandard/add', data)
export const updateCheckStandard = data => req.post('/cq/cqCheckStandard/edit', data)
export const delCheckStandard = standardId => req.post(`/cq/cqCheckStandard/delete?standardId=${standardId}`)
export const listCheckItemStandard = data => req.get('/cq/cqEvalItemStandard/list', data)

export const addBatch = data => req.post('/cq/cqEvalItemStandard/addBatch', data)

// 抽检规则
export const listRdcRule = data => req.get('/cq/cqRdcRule/list', data)
export const addRdcRule = data => req.post('/cq/cqRdcRule/add', data)
export const updateRdcRule = data => req.post('/cq/cqRdcRule/edit', data)
export const delRdcRule = ruleId => req.post(`/cq/cqRdcRule/delete?ruleId=${ruleId}`)

// 抽检规则
export const listEvalRule = data => req.get('/cq/cqEvalRule/list', data)
export const addEvalRule = data => req.post('/cq/cqEvalRule/add', data)
export const updateEvalRule = data => req.post('/cq/cqEvalRule/edit', data)
export const delEvalRule = ruleId => req.post(`/cq/cqEvalRule/delete?ruleId=${ruleId}`)

// 实测实量
export const listCheckMrq = data => req.get('/cq/cqCheckMrq/list', data)
export const addCheckMrq = data => req.post('/cq/cqCheckMrq/add', data)
export const updateCheckMrq = data => req.post('/cq/cqCheckMrq/edit', data)
export const delCheckMrq = mrqId => req.post(`/cq/cqCheckMrq/delete?mrqId=${mrqId}`)

// 安全文明
export const listCheckSc = data => req.get('/cq/cqCheckSc/list', data)
export const addCheckSc = data => req.post('/cq/cqCheckSc/add', data)
export const updateCheckSc = data => req.post('/cq/cqCheckSc/edit', data)
export const delCheckSc = scId => req.post(`/cq/cqCheckSc/delete?scId=${scId}`)

// 楼栋工序配置
export const listCheckConfig = data => req.post('/cq/cqCheckConfig/list', data)
export const addCheckConfig = data => req.post('/cq/cqCheckConfig/add', data)
export const updateCheckConfig = data => req.post('/cq/cqCheckConfig/edit', data)
export const delCheckConfig = configId => req.post(`/cq/cqCheckConfig/delete?id=${configId}`)
// 批量新增
export const addCheckConfigBatch = data => req.post('/cq/cqCheckConfig/batch', data)
export const addCheckConfigBatchByBuildIds = data => req.post('/cq/cqCheckConfig/batchByBuildIds', data)
// 批量删除
export const delCheckConfigBetch = ids => req.post('/cq/cqCheckConfig/deleteBatch', { ids })
// 楼栋工序配置-验收标准，目前不能编辑
export const listCheckConfigStandard = data => req.get('/cq/cqCheckConfig/get', data)

// 项目事故
export const listProAccident = data => req.get('/pro/accident/list', data)
export const addProAccident = data => req.post('/pro/accident/add', data)
export const updateProAccident = data => req.post('/pro/accident/edit', data)
export const delProAccident = accidentId => req.post('/pro/accident/delete', { accidentId })

// 报表管理
// 项目信息
export const getProjectListProById = data => req.get('/gcxt/project/listProById', data)
// 项目推进情况
export const getCheckReportProjectMothInfo = data => req.get('/cq/cqCheckReport/projectMothInfo', data)
// 得分详情
export const getScoreDetail = data => req.get('/cq/cqCheckReport/getScoreDetail', data)
// 报表导出
export const exportMothReport = data => req.get('/cq/cqRdcScore/exportMothReport', data, { responseType: 'arraybuffer' })

// 施工/承建单位
export const listRdcConstruction = data => req.get('/cq/cqRdcConstruction/list', data)
export const listSectionCons = data => req.get('/cq/ctGcxSection/listSectionCons', data) // 根据项目 {curProjectId} 获取施工单位列表
export const pageRdcConstruction = data => req.get('/cq/cqRdcConstruction/page', data)
export const addRdcConstruction = data => req.post('/cq/cqRdcConstruction/add', data)
export const updateRdcConstruction = data => req.post('/cq/cqRdcConstruction/edit', data)
export const delRdcConstruction = constructionId => req.post(`/cq/cqRdcConstruction/delete?cqRdcConstructionId=${constructionId}`)

// 测区外问题
export const listOutsideQues = data => req.get('/cq/cqRdcOutsideQues/list', data)
export const addOutsideQues = data => req.post('/cq/cqRdcOutsideQues/add', data)
export const updateOutsideQues = data => req.post('/cq/cqRdcOutsideQues/edit', data)
export const delOutsideQues = outsideQuesId => req.post(`/cq/cqRdcOutsideQues/delete`, { outsideQuesId })

// TODO 以下为假设接口
// 楼栋工序配置-验收标准
// export const listCheckConfigStandard = data => req.get('/cq/cqCheckConfigStandard/list', data)
export const addCheckConfigStandard = data => req.post('/cq/cqCheckConfigStandard/add', data)
export const updateCheckConfigStandard = data => req.post('/cq/cqCheckConfigStandard/edit', data)
export const delCheckConfigStandard = standardId => req.post(`/cq/cqCheckConfigStandard/delete?standardId=${standardId}`)
